import or1200_definitions
import sys
sys.path.append("..")
import pyrtl
from  pyrtl import GPUSim

# OR1200_XILINX_RAM32X1D = True
# OR1200_USE_RAM16X1D_FOR_RAM32X1D = True

class Or1200_xcv_ram32x8d(object):
    def __init__(self):
        self.A = pyrtl.Input(bitwidth=5, name='A')
        self.DPRA = pyrtl.Input(bitwidth=5, name='DPRA')
        self.D = pyrtl.Input(bitwidth=8, name='D')
        self.WCLK = pyrtl.Input(bitwidth=1, name='WCLK')
        self.WE = pyrtl.Input(bitwidth=1, name='WE')

        self.DPO = pyrtl.Output(bitwidth=8, name='DPO')
        self.SPO = pyrtl.Output(bitwidth=8, name='SPO')

        # self.DPO_0 = pyrtl.WireVector(bitwidth=8, name='DPO_0')
        # self.SPO_0 = pyrtl.WireVector(bitwidth=8, name='SPO_0')
        # self.DPO_1 = pyrtl.WireVector(bitwidth=8, name='DPO_1')
        # self.SPO_1 = pyrtl.WireVector(bitwidth=8, name='SPO_1')
        # self.WE_0 = pyrtl.WireVector(bitwidth=1, name='WE_0')
        # self.WE_1 = pyrtl.WireVector(bitwidth=1, name='WE_1')
        #
        # self.DPO = self.DPO_1 if self.DPRA[4] else self.DPO_0
        # self.SPO = self.SPO_1 if self.A[4] else self.SPO_0
        #
        # self.WE_0 = (not self.A[4]) and self.WE
        # self.WE_1 = self.A[4] and self.WE


if __name__ == '__main__':
    or1200_xcv_ram32x8d = Or1200_xcv_ram32x8d()
    sim = pyrtl.GPUSim_now.GPUSim(65536)
    sim.create_dll('xcv_ram.cu')
    #print(pyrtl.working_block())